package frame.networks.tables;

import java.util.List;

import javax.swing.table.DefaultTableModel;

import model.components.networks.network.PhysicalNetwork;

@SuppressWarnings("serial")
public class PhysicalNetworksTableModel extends DefaultTableModel
{
	private List< PhysicalNetwork > physicalNetworks;
	public List< PhysicalNetwork > getPhysicalNetworks(){ return physicalNetworks; }
	public void setPhysicalNetworks( List< PhysicalNetwork > physicalNetworks ){ this.physicalNetworks = physicalNetworks; }
	
	public PhysicalNetworksTableModel( String[] columnNames, int rowCount, List< PhysicalNetwork > physicalNetworks )
	{
		super( columnNames, rowCount );
		
		this.setPhysicalNetworks( physicalNetworks );
	}
	
	@Override
	public boolean isCellEditable( int x, int y )
	{
		return false;
	}

	public void refresh()
	{
		this.setRowCount( 0 );
		
		for( PhysicalNetwork physicalNetwork: this.getPhysicalNetworks() )
			this.addRow( new Object[]{ physicalNetwork.getName(), physicalNetwork.getState() } );
	}
	
}
